<?php

namespace app\admin\model;

use think\Db;
use think\Model;


class Skill extends Model
{

    

    

    // 表名
    protected $name = 'skill';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];

    public static function findInfoByCondition($condititon = [])
    {
        $record = self::where($condititon)->find();
        $skillStr = [];
        if ($record) {
            if ($record['skilljson']) {
                $skills = json_decode($record['skilljson'], true);
                foreach ($skills as $skillVal) {
                    if (is_array($skillVal)) {
                        foreach ($skillVal as $item) {
                            $skillStr = array_merge($skillStr, $item);
                        }
                    }
                }
            }
        }
        $record['skillstr'] = $skillStr ? implode(',', $skillStr) : '';
        return $record;
    }







}
